package org.gruposp2p.proyectokarma.domain;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.GeneratedValue;

@Entity
@Table(name="Vote")
public class Vote  implements java.io.Serializable {

	 private static final long serialVersionUID = 1L;
	 
	 @Id @GeneratedValue(strategy=IDENTITY)
     @Column(name="id", unique=true, nullable=false)
     private Long id;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="peerFromId", nullable=false)
     private Peer peerFrom;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="documentId")
     private Document document;     
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="commentId")
     private Comment comment;
     @ManyToOne(fetch=FetchType.LAZY)
     @JoinColumn(name="electionOptionId")
     private ElectionOption electionOption;
     @Temporal(TemporalType.TIMESTAMP)
     @Column(name="dateCreated", nullable=false, length=23)
     private Date dateCreated;
     @Column(name="stringValue")
     private String stringValue;
     @Column(name="numericValue")
     private Long numericValue;
     @Column(name="details", length=1000)
     private String details;

    public Vote() { }

	
    public Vote(Long id, Document document, Peer peerFrom, Date dateCreated) {
        this.id = id;
        this.document = document;
        this.peerFrom = peerFrom;
        this.dateCreated = dateCreated;
    }

    public Vote(Long id, Document document, Peer peerFrom, Date dateCreated, 
    		String stringValue, Long numericValue, String details) {
       this.id = id;
       this.document = document;
       this.peerFrom = peerFrom;
       this.dateCreated = dateCreated;
       this.stringValue = stringValue;
       this.numericValue = numericValue;
       this.details = details;
    }
   
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }

    public Document getDocument() {
        return this.document;
    }
    
    public void setDocument(Document document) {
        this.document = document;
    }

    public Peer getPeerFrom() {
        return this.peerFrom;
    }
    
    public void setPeerFrom(Peer peerFrom) {
        this.peerFrom = peerFrom;
    }

    public Date getDateCreated() {
        return this.dateCreated;
    }
    
    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }
    
    public String getStringValue() {
        return this.stringValue;
    }
    
    public void setStringValue(String stringValue) {
        this.stringValue = stringValue;
    }
    
    public Long getNumericValue() {
        return this.numericValue;
    }
    
    public void setNumericValue(Long numericValue) {
        this.numericValue = numericValue;
    }
    
    public String getDetails() {
        return this.details;
    }
    
    public void setDetails(String details) {
        this.details = details;
    }

	public void setComment(Comment comment) {
		this.comment = comment;
	}


	public Comment getComment() {
		return comment;
	}


	public void setElectionOption(ElectionOption electionOption) {
		this.electionOption = electionOption;
	}


	public ElectionOption getElectionOption() {
		return electionOption;
	}

}


